version: '3.7'

services:
  elasticsearch:
    image: elasticsearch:7.16.1
    volumes:
      - ./configs/elasticsearch/config.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
      # - ./docker_volumes/elasticsearch/data:/usr/share/elasticsearch/data
    environment:
      ES_JAVA_OPTS: "-Xmx512m -Xms512m"
      ELASTIC_USERNAME: "elastic"
      ELASTIC_PASSWORD: "test"
      discovery.type: single-node
    networks:
      - elk
    ports:
      - "9200:9200"
      - "9300:9300"

  logstash:
    image: logstash:7.16.2
    volumes:
      - ./configs/logstash/config.yml:/usr/share/logstash/config/logstash.yml:ro
      - ./configs/logstash/pipelines.yml:/usr/share/logstash/config/pipelines.yml:ro
      - ./configs/logstash/pipelines:/usr/share/logstash/config/pipelines:ro
    environment:
      LS_JAVA_OPTS: "-Xmx512m -Xms512m"
    # ports:
    #   - "5044:5044"
    #   - "5001:5000"
    #   - "9600:9600"
    networks:
      - elk
    depends_on:
      - elasticsearch

  kibana:
    image: kibana:7.16.1
    depends_on:
      - elasticsearch
    volumes:
      - ./configs/kibana/config.yml:/usr/share/kibana/config/kibana.yml:ro
    networks:
      - elk
    ports:
      - "5601:5601"

  beats:
    image: elastic/filebeat:7.16.2
    volumes:
      - ./configs/filebeat/config.yml:/usr/share/filebeat/filebeat.yml:ro
      - ./host_metrics_app/:/host_metrics_app/:ro
      - ./log_gen/:/log_gen/:ro
      # - /var/log/redis/:/log_redis/:ro
    networks:
      - elk
    depends_on:
      - elasticsearch

networks:
  elk:
    driver: bridge